package com.hs.user.service;

import com.hs.user.dao.StudentMapper;
import com.hs.user.entity.Student;
import com.hs.user.entity.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * Created by sheng on 2017/7/14.
 */
@Service("studentServiceImpl")
public class StudentServiceImpl implements StudentSercvice {

    @Autowired
    private StudentMapper studentMapper;
    @Autowired
    private TeacherService teacherService;

    @Override
    @Transactional
    public int createStudent(Student student) {
        studentMapper.insertSelective(student);
        Teacher teacher = new Teacher();
        teacher.setTid(8);
        teacher.setTusername("laowang");
        teacher.setTpassword("124");
        teacherService.createTeacher(teacher);
        return 0;
    }
}
